/*
 * SimBox.h
 *
 *  Created on: Apr 20, 2011
 *      Author: varunjn
 */

#ifndef SIMBOX_H_
#define SIMBOX_H_

#include "SimSolid.h"
#include <opal.h>

class SimBox : public SimSolid {

public:

	opal::Vec3r dimensions;

	SimBox(opal::Solid *s, std::vector<opalSamples::Entity*> *ent):SimSolid(s, ent){

	}

	virtual void create() {

			solid->setTransform(transform);
			opalSamples::Entity* entity = NULL;

			//(*solid)->setLinearDamping(0.2);
			solid->setStatic(isStatic);

			opal::BoxShapeData boxData;
			boxData.dimensions.set(dimensions.x, dimensions.y, dimensions.z);
			boxData.material.hardness = 0.2;
			boxData.material.bounciness = 0.6;
			boxData.material.friction = friction;
			boxData.material.density = 0.4;
			solid->addShape(boxData);

			entity = new opalSamples::BoxEntity();
					((opalSamples::BoxEntity*)entity)->setDimensions(
						boxData.dimensions);
	/*
			opal::Vec3r color(randomRealUniform(0, (opal::real)0.7),
				randomRealUniform(0, (opal::real)0.7),
				randomRealUniform(0, (opal::real)0.7));
*/
			entity->setColor(randomRealUniform(0, 0.7),
					randomRealUniform(0, 0.7),
					randomRealUniform(0, 0.7));


			entity->attachToSolid(solid);
			gEntities->push_back(entity);
		}

};

#endif /* SIMBOX_H_ */
